
#ifndef GRAPHICS_H
#define GRAPHICS_H

#include <iostream>
#include <gl/glut.h>
#include "vec3f.h"

//#include "GraphicsWindow.h"
#include "Sim.h"
#include "GravBody.h"
#include "Geosphere.h"
#include "GeosphereFace.h"
#include "GeosphereVert.h"
#include "Star.h"

using namespace std;

class Graphics {

	public:

		Graphics(int argc, char *argv[], Sim* sim);

		void start();
		void displayFrame();
		void reshapeWindow(int,int);
		void keysSpecialDown(int key, int x, int y);
		void keysSpecialUp(int key, int x, int y);

		// Static members for GLUT callbacks
		static void callbackDisplayFrame();
		static void callbackReshapeWindow(int,int);
		static void callbackKeysSpecialDown(int key, int x, int y);
		static void callbackKeysSpecialUp(int key, int x, int y);

	private:

		void initialize();
		void draw();
		void drawStars();
		void drawGravBodies();
		void drawGeosphere(Geosphere* geo, int detailLevels);
		void drawGeosphereFace(GeosphereFace* face, int levelsLeft);
		void drawGeosphereHistory(GravBody* gravBody, const vec3f* loc);

		Sim* sim;
		int followBodyIndex;
		vec3f followBodyLoc;
		bool keyRightDown;
		bool keyLeftDown;
		float camDist;
		bool camAtMoon;
		float lightPos[4];
		Star* stars;
		unsigned int numStars;

		vec3f eye;
		vec3f view;

		float ones[4];
		float mids[4];
		float zeros[4];
		float alphas[4];
		float blues[4];

};

// Global object pointer so GLUT can access Graphics member functions
extern Graphics* gfx;

#endif
